package com.qf.springmvc.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @author 王博康
 * @version 1.0
 * @project 06_springmvc_interceptor
 * @description: TODO
 * @date 2022/3/9 19:49 星期三
 */

@WebFilter(urlPatterns ="/*")
public class LoginFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.err.println("LoginFilter类的init方法执行了...");

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        System.err.println("过滤器：登录验证");
        chain.doFilter(request,response );
        System.err.println("过滤器：登录请求代码执行完毕");
    }

    @Override
    public void destroy() {
        System.err.println("LoginFilter类的destroy方法执行了...");
    }
}
